package com.bdqn.util;

import lombok.Data;
import org.springframework.stereotype.Component;

import java.util.Random;

@Component
@Data
public class RandomUtil {

    /**
     * 生成患者编号
     */
    public String randomPatient(){
        StringBuilder stringBuilder = new StringBuilder();
        Random random = new Random();
        for (int i = 0; i < 19; i++) {
            int digit = random.nextInt(10);
            stringBuilder.append(digit);
        }
        String randomNumber = stringBuilder.toString();
        String hz = "HZ";
        String patientId = hz+randomNumber;
        return patientId;
    }


    /**
     * 生成挂号编号
     */
    public String randomRegistration(){
        StringBuilder stringBuilder = new StringBuilder();
        Random random = new Random();
        for (int i = 0; i < 19; i++) {
            int digit = random.nextInt(10);
            stringBuilder.append(digit);
        }
        String randomNumber = stringBuilder.toString();
        String gh = "GH";
        String registrationId = gh+randomNumber;
        return registrationId;
    }

    /**
     * 生成病例编号
     */
    public String randomChId(){
        StringBuilder stringBuilder = new StringBuilder();
        Random random = new Random();
        for (int i = 0; i < 19; i++) {
            int digit = random.nextInt(10);
            stringBuilder.append(digit);
        }
        String randomNumber = stringBuilder.toString();
        String ch = "CH";
        String chId = ch+randomNumber;
        return chId;
    }
}
